<?php
$this->breadcrumbs=array(
	'综合控制台'=>array($this->pre_module_url.'/index/index'),
	'广告管理'=>array($this->pre_module_url.'/adse/admin'),	
	'广告管理'=>array($this->pre_module_url.'/adse/admin'),
);
?>

<div class="hr_10"></div>
<div class="pro_filter c_f">
	<div class="filter f_l">
	<?php $form=$this->beginWidget('CActiveForm', array(
		'action'=>Yii::app()->createUrl($this->route),
		'method'=>'get',
	)); ?>
			<span id="menubox" style="width:100%; display:block; margin-bottom:10px;" class="cont" align="left">
				选择页面：
				<?php 
					echo CHtml::dropDownList('zna_id',$zna_id['1'],Nav::model()->getTopData(),array('class'=>'mr10 s_ipt level_1 w_120','onchange'=>'afterSelect(1,this.value)','id'=>'menuselect1')); 
					echo CHtml::dropDownList('zna_id2',$zna_id['2'],Nav::model()->getChildData($zna_id['1']?$zna_id['1']:-1),array('class'=>'mr10 s_ipt level_1 w_120','onchange'=>'afterSelect(2,this.value)','id'=>'menuselect2')); 
					echo CHtml::dropDownList('zna_id3',$zna_id['3'],Nav::model()->getChildData($zna_id['2']?$zna_id['2']:-1),array('class'=>'mr10 s_ipt level_1 w_120','onchange'=>'afterSelect(3,this.value)','id'=>'menuselect3')); 
				?>
				<span id="adzonebox">
					广告位：<?php echo CHtml::dropDownList('Adse[zdz_id]',$model->zdz_id,Adzone::model()->getAdzonesForSelect($zna_id['0']),array('class'=>'s_ipt w_170','id'=>"adzoneselect")); ?>
				</span>                                      
			</span>                                   
			<label class="mr5">广告状态：
				<?php echo CHtml::dropDownList('status',$model->status,Adse::model()->statusOptions,array('class'=>'s_ipt w_120')); ?> 
			</label>
			<?php echo $form->textField($model,'zds_title',array('class'=>'t_ipt w_250','maxlength50','value'=>$model->zds_title?$model->zds_title:'关键字','onfocus'=>'this.value=this.value=="关键字"?"":this.value','onblur'=>'this.value=this.value==""?"关键字":this.value')); ?>
			<button class="mem_bgx mem_btn01" type="submit" name="">查找</button>
	<?php $this->endWidget(); ?>
	</div>
</div>
<table class="list_table list_table2" width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <th width="" class="pl15">广告图片</th>
                    <th width="18%">广告标题</th>
                    <th width="15%">所属类目</th>
                    <th width="15%">有效期至</th>
                    <th width="12%">状态</th> 
                    <th width="10%">操作</th>                                                    
                </tr>
</table>
<?php     
	$this->widget('zii.widgets.CListView', array(    
	    'dataProvider'=>$model->search(),    
	    'itemView'=>'_admin',      
	    'emptyText'=>'暂时没有数据',    
	    'selectAll'=>array('ids[]','id[]'),    
	    'itemsTagName'=>'table',  
	    'itemsOptions'=>array('class'=>'list_table list_table2','width'=>'100%','cellpadding'=>0,'cellspacing'=>0),  
	    'artLink'=>array(    
	        //批量删除    
	        array(Yii::t('adm','Delete All'),$this->pre_module_url.'/adse/delete','确认批量删除选中数据！'),    
	        //下架    
	        array(Yii::t('cmp','downshelf'),$this->pre_module_url.'/adse/batchChange','确认上架选中产品！'),    
	    ),    
    ));    
?>  

<script>
	function afterSelect(level,menuid){
		$('#menuselect'+level).nextAll('select').html('<option value="0">请选择</option');
		menuid = parseInt(menuid)==0 ? -1 : menuid;
		$.getJSON("/manage/nav/getchildmenu", { menuid: menuid, level: level }, function(data){
			if(data.amount){
				var nextLevel=parseInt(data.level)+1;
				var next = '';
				$.each(data.items, function(i,item){
					next += '<option value="'+i+'">'+item+'</option>';
				});
				next += '';
				$('#menuselect'+nextLevel).html(next);
			}
			$.getJSON("/manage/adzone/getadzonelist", { menuid: data.menuid, level: data.level }, function(list){
				var text = '<select class="mr10 s_ipt w_170" name="Adse[zdz_id]" id="adzoneselect">';
				$.each(list.items, function(i,item){
					text += '<option value="'+i+'">'+item+'</option>';
				});
				text += '</select>';
				$('#adzonebox').html(text);
			});
		});
	}
</script>